package com.fxd.service.impl;

import com.fxd.dao.IAccountDao;
import com.fxd.dao.impl.accountDaoImpl;
import com.fxd.factory.beanFactory;
import com.fxd.service.IAccountService;

/**
 * @auther fuxudong
 * @date 2021/1/12 - 16:45
 */
public class AccountServiceImpl implements IAccountService {
    //    private IAccountDao accountDao = new accountDaoImpl();
    private IAccountDao accountDao = (IAccountDao) beanFactory.getBean("accountDao");
    //注意，不要定义类成员，单例模式会引发线程问题,定义在方法里，会初始化。
    // private int i = 1;

    public void saveAccount() {
        int i=1;
        accountDao.saveAccount();
        System.out.println(i);
        i++;
    }
}
